package com.lee.boot.head.first.demo.socket.controller;

import com.lee.boot.head.first.demo.socket.pojo.AricMessage;
import com.lee.boot.head.first.demo.socket.pojo.AricResponse;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.stereotype.Controller;

/**
 * @Auther: Lee
 * @Date: 2018/6/8 10:50
 * @Description: // TODO: 2018/6/8 没成还是要再改
 */
@Controller
public class DemoSocketContrller {

    @MessageMapping("/welcome") //当浏览器向服务端发送请求时,通过@MessageMapping映射/welcome这个地址,类似于@ResponseMapping
    public AricResponse welcome(AricMessage aricMessage) {
        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new AricResponse("Server receiving user :" + aricMessage.getName() + "'s messsage ,and response ok!");
    }

}
